package com.ktjy.entity;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * @return 13141
 * 2025/6/19
 * 08:43
 */
public class Pet {
    private static final Logger LOGGER = LoggerFactory.getLogger(Pet.class);

    // 宠物
    public Pet() {}
    private String name;  // 宠物名
    private int age; // 宠物年龄

    // 自我介绍
    public void introduce() {
        System.out.println("我是 " + this.name + ", 今年 " + this.age + "岁");
    }

    // 属性封装
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        // 如果 setAge被调用，则输出日志
        LOGGER.debug("Pet对象的setAge方法被调用！参数 age = {} ", age);
//        System.out.println("被调用");
        this.age = age;
    }
}
